package com.example.blogdemo

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.example.blogdemo.databinding.FragmentRecyclerviewBinding

abstract class RecyclerViewFragment : Fragment() {
    protected lateinit var binding: FragmentRecyclerviewBinding
    protected val adapter = DefaultAdapter()
    protected val items= mutableListOf<ClickItem>()
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentRecyclerviewBinding.inflate(layoutInflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        adapter.submitList(items)
        binding.recyclerBody.adapter=adapter

    }
}